|
|
|
Lab 4 -
Synthesis -- Part 1
Combinational circuits
Цел
|
Придобиване на практически опит за работа с
програма за логически синтез.
|
Задание |
Да се извърши логически синтез на последователни
и синхронни схеми. Да се анализират резултатите от синтеза --
схеми, бързодействие, използвани ресурси.
|
|
Указания

|
При синтеза да се използват FPGA
интегрални схеми от фамилията Virtex на фирмата
Xilinx.
За анализ на схемите използвайте
резултатите преди архитектурната оптимизация.
За анализ на бързодействието и
необходимите ресурси използвайте оптимизираните
резултати. |
Задача 1 --
Мултиплексори
На фигури 1.1 и 1.2 са дадени два модела на
мултиплексори 4 към 1, реализирани с оператори if и case (файловете
са if_mux.vhd
и case_mux.vhd).
Сравнете получените след синтеза схеми. Има ли разлики между
схемите? Обяснете резултатите.
|
Фигура 1.1 --
Модел на мултиплексор с оператор if
|
library ieee;
use ieee.std_logic_1164.all;
entity mux1 is
port (output_signal: out std_logic;
a, b, c, d: in std_logic;
sel: in std_logic_vector(1 downto 0));
end mux1;
architecture if_mux of mux1 is
begin
process (sel, a, b, c, d)
begin
if sel = "00" then
output_signal <= a;
elsif sel = "01" then
output_signal <= b;
elsif sel = "10" then
output_signal <= c;
else
output_signal <= d;
end if;
end process;
end if_mux;
|
|
Фигура 1.2 --
Модел на мултиплексор с оператор case |
library ieee;
use ieee.std_logic_1164.all;
entity mux2 is
port (output_signal: out std_logic;
a, b, c, d: in std_logic;
sel : in std_logic_vector(1 downto 0));
end mux2;
architecture case_mux of mux2 is
begin
process (sel, a, b, c, d)
begin
case sel is
when "00" => output_signal <= a;
when "01" => output_signal <= b;
when "10" => output_signal <= c;
when others => output_signal <= d;
end case;
end process ;
end case_mux;
|
Задача 2 --
Приоритетна логика
На фигура 2.1 е даден модел на контролер на
прекъсвания (файла е interupt.vhd).
Приоритета на сигналите за прекъсвания е както следва:
 |
nmi -
най-висок приоритет |
 |
float |
 |
int |
 |
peripheral |
Анализирайте получената след синтеза схема.
Сравнвте структурата на схемата със схемите на мултиплексорите от
задача 1. Обяснете резултатите.
|
Фигура 2.1 --
Контролер на прекъсвания
|
library ieee;
use ieee.std_logic_1164.all;
entity interupt is
port( nmi,float,int,peripheral: in std_logic;
flush_cache: out std_logic;
address: out std_logic_vector(7 downto 0)
);
end interupt;
architecture behave of interupt is
constant nop: std_logic_vector(7 downto 0):="00000000";
constant nmi_addr: std_logic_vector(7 downto 0):="00000001";
constant float_addr: std_logic_vector(7 downto 0):="00000010";
constant int_addr: std_logic_vector(7 downto 0):="00000011";
constant periph_addr: std_logic_vector(7 downto 0):="00000100";
begin
process (nmi,float,int,peripheral)
begin
flush_cache <= '0';
if nmi = '1' then
address := nmi_addr;
elsif float = '1' then
address := float_addr;
flush_cache <= '1';
elsif int = '1' then
address := int_addr;
flush_cache <= '1';
elsif peripheral = '1' then
address := periph_addr;
else
address :=nop;
end if;
end process;
end behave;
|
Задача 3 -- Модел на АЛУ
На фигура 3.1 е даден модел на АЛУ (фаила е alu.vhd).
При опит за синтез се получава съобщение за грешка. Намерете
причината за тази грешка и ч
отстранете.
|
Фигура 3.1 --
Модел на АЛУ |
-- ALU
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity alu is
port ( a, b : in std_logic_vector(7 downto 0);
opcode: in std_logic_vector(1 downto 0);
clk: in std_logic;
result: out std_logic_vector(7 downto 0) );
end alu;
architecture behave of alu is
constant plus: std_logic_vector(1 downto 0) := b"00";
constant minus: std_logic_vector(1 downto 0) := b"01";
constant equal: std_logic_vector(1 downto 0) := b"10";
constant not_equal: std_logic_vector(1 downto 0) := b"11";
begin
process (opcode,a,b)
begin
case opcode is
when plus => result <= a + b; -- add
when minus => result <= a - b; -- subtract
when equal => -- equal
if (a = b) then
result <= X"01";
else
result <= X"00";
end if;
when not_equal => -- not equal
if (a /= b) then
result <= X"01";
else
result <= X"00";
end if;
end case;
end process;
end behave;
|
| |